<?xml version = '1.0' encoding = 'UTF-8'?>
<HBRRepo><variables/><rulesets/><rules><rule id="1" name="OQP_Validate Seasonality" product="Planning"><property name="application">SalesPln</property><property name="plantype">OEP_QTP</property><property name="seeded">true</property><script type="groovy">			/*PURPOSE: This business rules checks whehter seasonality percentages input is equal to 100% or not */			
            List&lt;DataGrid.Row> rows = operation.grid.getRows();
			int iRow=0;
			int TotRows= rows.size()
            /*if total  number of rows is greater than 1, assumes last row is equal to previous year seasonality percentage then it valides percentages for all rows except last row*/
			 if (TotRows>1)
			 {
				for (DataGrid.Row row : rows) 
				{
				 if (iRow&lt;TotRows-1)
				 {
					Double rowAmt = 0d;	
					List&lt;DataGrid.DataCell> subRows = row.getData();
					for(DataGrid.DataCell cell : subRows) 
					{
					String periodName=cell.getPeriodName();
                  /*Sum percentage of individula months*/
					if(!periodName.equals("YearTotal"))
					{
						rowAmt=	rowAmt+cell.getData()             
					}    
					}  
					println(rowAmt.round(2))
                    /*Checks if total sum of percentage input of individul months is equal to 100% or not*/
					if (rowAmt.round(2)!=1.00)
					{
					Double totAmt=rowAmt.round(2)*100
					 throwVetoException("Seasonality that you have set is "+totAmt.round()+"%. It should be  equal to 100%")        
					}
				  iRow=iRow+1
				 }  
				}
				
			 } 
			 if (TotRows==1)
			 {
			 for (DataGrid.Row row : rows) 
				{
					Double rowAmt = 0d;	
					List&lt;DataGrid.DataCell> subRows = row.getData();
					for(DataGrid.DataCell cell : subRows) 
					{
					String periodName=cell.getPeriodName();
                    /*Sum percentage of individula months*/
					if(!periodName.equals("YearTotal"))
					{
						rowAmt=	rowAmt+cell.getData()             
					}    
					}  
					println(rowAmt.round(2))
                    /*Checks if total sum of percentage input of individul months is equal to 100% or not*/
					if (rowAmt.round(2)!=1.00)
					{
						Double totAmt=rowAmt.round(2)*100					 
					  throwVetoException("Seasonality that you have set is "+totAmt.round()+"%. It should be  equal to 100%")  
					}
				}
			 
			 }		
		
		</script></rule></rules><components/><deployobjects><deployobject product="2" application="salespln" plantype="oep_qtp" obj_id="1" obj_type="1" name="OQP_VALIDATE SEASONALITY"/></deployobjects></HBRRepo>